package com.example.administrator.testxingpiao.ui.main.exercise;

import com.example.administrator.testxingpiao.bean.ExerciseBean;
import com.example.administrator.testxingpiao.httputils.HttpUtils;

import java.util.HashMap;

/**
 * Created by Administrator on 2016/8/7.
 */
public class ExercisePresenter implements ExerciseContract.Presenter{
    private ExerciseContract.View view;
    private ExerciseContract.Model model;
    public  ExercisePresenter(ExerciseContract.View view,ExerciseContract.Model model){
        this.view = view;
        this.model = model;
    }
    @Override
    public void initData(HashMap<String,String> params) {
        model.getExercise(params, new HttpUtils.HttpCallBack<ExerciseBean>() {
            @Override
            public void onSuceess(ExerciseBean exerciseBean) {
                view.onSuccessGetExercise(exerciseBean);
            }

            @Override
            public void onFail() {
                view.onFailGetExercise("网络连接错误");
            }
        });
    }
}
